<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .wrap{
            position: relative;
        }
        .wrap div{
            height: 100px;
        }
        .left{
            /* background: #00f;
            width: 200px;
            position: absolute;
            left: 0; */

            float: left;
            width: 200px;
            background: #00f
        }
        .right{
            /* width: 200px;             */
            /* background: #f00;
            position: absolute;
            left: 200px;
            right: 0; */


            width: 100%-200px;
            float: right;
            background: #f00
        }
        .middle{
            /* position: absolute;
            background: #0f0;
            left: 200px;
            right: 200px; */

            background: #0f0;
        }
    </style>
</head>
<body>
    <div class="wrap">
        <div class="left"></div>
        <div class="right"></div>
        <!-- <div class="middle"></div> -->


        <!-- <div class="right"></div> -->

    </div>
    <button id="btn">防抖</button>
    <script>
        let btn = document.getElementById('btn');
        btn.addEventListener('click',debounceHoc(debounce),false);
        function debounceHoc(fn){
            let timer = null;
            return function(){
               clearTimeout(timer);
               timer = setTimeout(function(){
                   fn()
               },1000)
            }
        }
        function throttle(fn,delay){
            let start = +new Date;

            return function(){
                let end = +new Date;
                if(end - start >delay){
                    fn();
                    start = end
                }
            }
        }
        function debounce(){
            console.log(1);
        }
    </script>

</body>
</html>